version: "3"

networks:
  chat-bot:

services:
  tg-bot:
    build: kts_backend/
    container_name: bot
    ports:
      - "8080:8080"
    networks:
      - chat-bot
    restart: always
    links:
      - db
    environment:
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_HOST: ${POSTGRES_HOST}
      POSTGRES_PORT: ${POSTGRES_PORT}
      POSTGRES_ROOT_PASSWORD: ${POSTGRES_ROOT_PASSWORD}

  db:
    image: postgres:latest
    container_name: db
    ports:
      - "5432:5432"
    networks:
      - chat-bot
    volumes:
      - ./db:/docker-entrypoint-initdb.d/:ro
    environment:
      POSTGRES_PASSWORD: ${POSTGRES_ROOT_PASSWORD}
